import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  /* config options here */
  
  // 启用standalone输出用于Docker部署
  output: 'standalone',
  
  // 配置外部资源
  images: {
    domains: ['fonts.gstatic.com', 'fonts.googleapis.com'],
  },
  
  // 配置字体代理（解决国内网络问题）
  async rewrites() {
    return [
      {
        source: '/fonts/:path*',
        destination: 'https://fonts.googleapis.com/:path*',
      },
      {
        source: '/font-files/:path*',
        destination: 'https://fonts.gstatic.com/:path*',
      },
    ];
  },
  
  // 配置headers解决CORS问题
  async headers() {
    return [
      {
        source: '/fonts/:path*',
        headers: [
          {
            key: 'Access-Control-Allow-Origin',
            value: '*',
          },
        ],
      },
    ];
  },
  
  // 实验性功能
  experimental: {
    optimizePackageImports: ['@/components/ui'],
  },
};

export default nextConfig;